<template>
  <div>
    <!--条件筛选-->
    <!-- <TopFilter :list="topFilterList" :cols="3" labelWidth="110" @filterChange="changeHandle" @onCollapse="collapseHandle"></TopFilter> -->
    <!--操作 -->
    <button-area :style="{ paddingLeft: '80px' }"></button-area>
    <!-- 列筛选-->
    <FilterTable
      ref="table"
      columnsRef="lhmChangeCustomerGradeUp"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'records'"
      :onColumnsChange="columns => (this.columns = columns)"
    >
      <!--列操作-->
      <template slot="controls"> </template>
    </FilterTable>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import { getChangeCustomerGradeUpdate } from '@/api/customerRepair/customerInfo/changeCustomerGrade';

export default {
  name: 'LHMChangeCustomerGradeUp',
  mixins: [dictionary],
  props: {
    type: {
      type: String,
      default: 'add'
    },
    rowData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    // this.conf = { add: '新增', delete: '删除', edit: '编辑', show: '显示' };
    return {
      // topFilterList: this.createTopFilterList(),
      fetchParams: { id: this.rowData[0].OWNER_NO, xhrAbort: false },
      visible: false,
      visible1: false,
      dialogTitle: '',
      fetchApi: getChangeCustomerGradeUpdate,
      columns: this.createTableColumns(),
      handleType: '',
      formData: {},
      tableData: [],
      ids: []
    };
  },
  mounted() {
    // 分页
    this.BaseTable = this.$refs.table.$refs.pageTable;
    console.log(this.rowData[0].OWNER_NO);
  },
  methods: {
    // createTopFilterList() {
    //   return [
    //     {
    //       type: 'DATE',
    //       label: '建档日期',
    //       fieldName: 'haltAt',
    //       placeholder: '选择日期',
    //       rules: [{ required: true, message: '请选择建档日期', trigger: 'blur' }]
    //     },
    //     {
    //       type: 'DATE',
    //       label: '最后维修日期',
    //       fieldName: 'haltAt',
    //       placeholder: '选择日期'
    //     },
    //     {
    //       type: 'INPUT',
    //       label: '维修次数累计',
    //       fieldName: 'customeRgrade '
    //     },
    //     {
    //       type: 'INPUT',
    //       label: '累计金额',
    //       fieldName: 'customeRgrade '
    //     },
    //     {
    //       type: 'INPUT',
    //       label: '原客户级别',
    //       fieldName: 'CUSTOME_RGRADE '
    //     }
    //   ];
    // },
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '客户名称',
          dataIndex: 'OWNER_NAME',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '新客户级别代码',
          dataIndex: 'NEW_CUSTOME_RGRADE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '新客户级别名称',
          dataIndex: 'NEW_CUSTOME_RGRADE_NAME',
          sorter: true,
          hidden: true,
          filter: true,
          filterType: 'input'
        },

        {
          title: '原客户级别代码',
          dataIndex: 'OLD_CUSTOME_RGRADE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '原客户级别名称',
          dataIndex: 'OLD_CUSTOME_RGRADE_NAME',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '调整标识',
          dataIndex: 'UPDATE_DEGRADE',
          sorter: true,
          filter: true,
          filterType: 'input',
          editType: 'select',
          editItems: [
            { value: 82041001, text: '上调' },
            { value: 82041002, text: '下降' }
          ]
        }
      ];
    }
    // selectData(val) {
    //   this.tableData = val;
    // },
    // addHandle() {
    //   // 新建
    //   this.handleType = 'add';
    //   this.showHandler();
    // },
    // editHandle(row) {
    //   this.handleType = 'edit'; // 编辑
    //   this.formData = row;
    //   this.showHandler();
    // },
    // changeHandle(val) {
    //   this.fetchParams = Object.assign({}, val);
    // },
    // collapseHandle() {
    //   this.$nextTick(() => {
    //     this.BaseTable.EXECUTE_RESET_HEIGHT();
    //   });
    // },
    // async saveDialog() {
    //   let res = {};
    //   if (this.tableData == null) return;
    //   alert('1');
    //   res = await addCustomeRgradeUpdatet({ customeRgradeUpdateDTOList: this.tableData });
    //   if (res.resultCode === 200) {
    //     this.closeDialog('refresh');
    //   }
    // },
    // showHandler() {
    //   //  alert("++");
    //   // 显示
    //   this.dialogTitle = `更改历史`;
    //   this.visible = true;
    // },
    // closeHandler(val, type) {
    //   //    alert(1)
    //   // 关闭
    //   this.visible = val;
    //   if (type === 'refresh') {
    //     //    alert("type:"+type);
    //     // 重新加载
    //     this.fetchParams = { ...this.fetchParams };
    //   }
    // }
  }
};
</script>

<style lang="less" scoped></style>
